<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Directions</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script
	src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAA_3-iMCnBiS6e686QyocIoBQWC1KCebTmOdNH-QL4iyYQRZibbxS2Lz0VVNxHsHBcIUz_43QHAmBLNQ"
	type="text/javascript"></script>
<script type="text/javascript"> 
    // Create a directions object and register a map and DIV to hold the 
    // resulting computed directions
 
    var map;
    var directionsPanel;
    var directions;

    
    function drawMap(address) {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      directionsPanel = document.getElementById("route");
      directions = new GDirections(map, directionsPanel);
      // TODO: take a user's address and use that instead
      directions.load("from: " + address + " to: 430 Emerson St, Palo Alto, CA 94301-1604 (Aquarius Theatre)");
    	
    }
    
    function initialize() {
      if(location.href.split("?")[1]) {
          var address = location.href.split("?")[1].split("=")[1];
      } else {
          var address = "";
      }

      address.replace(/^\s+|\s+$/g,"")
      
      if (address != "") {
          drawMap(address);
      } else {
    	  drawMap("Washington Square Hall, San Jose, California 95112 (SJSU)");
      }
    }
    </script>
</head>

<body onload="initialize()">

<table align="center">
        <tr><td><a href="index.php">Home</a> | <a href="movie-feedback.php">Leave Feedback</a> | <a href="directions.html">Directions</a> | <a href="contactus.php">Contact Us</a> | <a href="admin.php">Admin</a> | <a href="logout.php">Logout</a><td width="10"/>
    </td>
</tr> 
</table>


<div align="right">
<form name=form method=get action="directions.html">
<input type=text name="address" size="24">
<input type=submit value="Enter address"></td>
</form>
</div>
<h1>Directions</h1>
<br>
<br>

<div id="map_canvas"
	style="width: 70%; height: 600px; float: left; border: 1px solid black;"></div>
<div id="route" style="width: 25%; height: 600px; float: right;"></div>
<br />
</body>
</html>
